package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.oms.Oms_Order_Return_Reason;
import com.shop.service.Oms_Order_Return_Reason_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 退货原因-李贝贝-后台
 */
@RestController
@RequestMapping("/order_return_reason")
public class Oms_Order_Return_Reason_Controller {

    @Autowired
    private Oms_Order_Return_Reason_Service oms_order_return_reason_service;

    /**
     * 显示所有退货原因-后台
     * @param page
     * @param limit
     * @param oms_order_return_reason
     * @return
     */
    @GetMapping("/find_Admin_Oms_Order_Return_Reason")
    public LayuiUtils<Oms_Order_Return_Reason> find_Admin_Oms_Order_Return_Reason(Integer page, Integer limit, Oms_Order_Return_Reason oms_order_return_reason){
        Page<Oms_Order_Return_Reason> pages = new Page<>(page,limit);
        return oms_order_return_reason_service.find_oms_order_return_reason(pages,oms_order_return_reason);
    }

    /**
     * 增加退货原因
     * @param oms_order_return_reason
     * @return
     */
    @PostMapping("/insert_Oms_Order_Return_Reason")
    public R insert_Oms_Order_Return_Reason(@RequestBody Oms_Order_Return_Reason oms_order_return_reason){
        System.out.println(oms_order_return_reason);
        return oms_order_return_reason_service.insert_oms_order_return_reason(oms_order_return_reason);
    }

    /**
     * 删除退货原因
     * @param id
     * @return
     */
    @DeleteMapping("/delete_Oms_Order_Return_Reason")
    public R delete_Oms_Order_Return_Reason(@RequestParam List<Long> id){
        return oms_order_return_reason_service.delete_oms_order_return_reason(id);
    }

    /**
     * 修改退货原因
     * @param oms_order_return_reason
     * @return
     */
    @PutMapping("/update_Oms_Order_Return_Reason")
    public R update_Oms_Order_Return_Reason(@RequestBody Oms_Order_Return_Reason oms_order_return_reason){
        System.out.println(oms_order_return_reason);
        return oms_order_return_reason_service.update_oms_order_return_reason(oms_order_return_reason);
    }
}
